//
//  WHMenuTipsCell.m
//  BinFengExpressOwner
//
//  Created by 邓伟浩 on 2018/10/13.
//  Copyright © 2018年 BinFeng. All rights reserved.
//

#import "WHMenuTipsCell.h"

@implementation WHMenuTipsCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        [self setUpUI];
    }
    return self;
}

- (void)setUpUI {
    [self.contentView addSubview:({
        _tipsImageView = [[UIImageView alloc] init];
        _tipsImageView.contentMode = UIViewContentModeScaleAspectFit;
        _tipsImageView;
    })];
    
    [_tipsImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.contentView.mas_left).offset(kRealwidth(15));
        make.width.mas_equalTo(kRealwidth(20));
        make.height.mas_equalTo(kRealwidth(20));
        make.centerY.mas_equalTo(self.contentView.mas_centerY);
    }];
    
    [self.contentView addSubview:({
        _tipsLabel = [[UILabel alloc] init];
        _tipsLabel.textAlignment = NSTextAlignmentLeft;
        _tipsLabel.font = SYSTEMFONT(kRealwidth(16));
        _tipsLabel.textColor = CFontTitleBlackColor;
        _tipsLabel;
        
    })];
    
    [_tipsLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.tipsImageView.mas_right).offset(kRealwidth(15));
        make.centerY.mas_equalTo(self.contentView.mas_centerY);
        make.height.mas_equalTo(kRealwidth(16));
    }];
    
    [self.contentView addSubview:({
        _rightImageView = [[UIImageView alloc] init];
        _rightImageView.contentMode = UIViewContentModeScaleAspectFit;
        _rightImageView.image = IMAGE_NAMED(@"icon_tips_right");
        _rightImageView;
    })];
    
    [_rightImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(self.contentView.mas_right).offset(-kRealwidth(15));
        make.width.mas_equalTo(kRealwidth(8));
        make.height.mas_equalTo(kRealwidth(14));
        make.centerY.mas_equalTo(self.contentView.mas_centerY);
    }];
    
    [self.contentView addSubview:({
        _descriptionLabel = [[UILabel alloc] init];
        _descriptionLabel.textAlignment = NSTextAlignmentRight;
        _descriptionLabel.font = SYSTEMFONT(kRealwidth(16));
        _descriptionLabel.textColor = CFontTitleBlackColor;
        _descriptionLabel;
        
    })];
    [_descriptionLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(_rightImageView.mas_left).offset(-kRealwidth(15));
        make.centerY.mas_equalTo(self.contentView.mas_centerY);
        make.height.mas_equalTo(kRealwidth(16));
    }];
    
    [self.contentView addSubview:({
        _messageImageView = [[UIImageView alloc] init];
        _messageImageView.contentMode = UIViewContentModeScaleAspectFit;
        _messageImageView.hidden = YES;
        _messageImageView;
    })];
    
    [_messageImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(_rightImageView.mas_left).offset(-kRealwidth(15));
        make.width.mas_equalTo(kRealwidth(51));
        make.height.mas_equalTo(kRealwidth(16));
        make.centerY.mas_equalTo(self.contentView.mas_centerY);
    }];
}

- (void)prepareForReuse {
    [super prepareForReuse];
    _tipsImageView.image = nil;
    _tipsLabel.text = @"";
    _rightImageView.image = IMAGE_NAMED(@"icon_tips_right");
    _descriptionLabel.text = @"";
    _messageImageView.hidden = YES;
    _messageImageView.image = nil;
    
}

@end
